######## START OF MAKEFILE ########
# Set 'ANDROID_NDK' to the location your NDK is installed
ANDROID_NDK = /home/zhaorenming/Develop/android-ndk-r8d

# determine the tools directory based on Windows install paths
TOOLDIR=$(ANDROID_NDK)/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin

# set tools based on TOOLDIR
CC      =       $(TOOLDIR)/arm-eabi-gcc
CPP     =       $(TOOLDIR)/arm-eabi-g++
STRIP   =       $(TOOLDIR)/arm-eabi-strip

# prepare the NDK include path and library paths/options
INCLUDES +=-I $(ANDROID_NDK)/build/platforms/android-3/arch-arm/usr/include \

LIBS += -Wl,-rpath-link=$(ANDROID_NDK)/build/platforms/android-3/arch-arm/usr/lib \
   -L$(ANDROID_NDK)/build/platforms/android-3/arch-arm/usr/lib \
   -lc -lm -lstdc++ -Wl,--no-undefined -ldl \
   -Wl,--gc-sections -Bdynamic -Wl,-z,nocopyreloc  \
   -Wl,-dynamic-linker,/system/bin/linker  \
   -Wl,-T,$(ANDROID_NDK)/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/ldscripts/armelf.x -Wl -nostdlib \
   $(ANDROID_NDK)/build/platforms/android-3/arch-arm/usr/lib/crtbegin_dynamic.o \
   $(ANDROID_NDK)/build/platforms/android-3/arch-arm/usr/lib/crtend_android.o

CFLAGS += $(INCLUDES)
CPPFLAGS += $(CFLAGS)
LFLAGS = $(LIBS)


APP  = test
OBJS = test.o sqlite3.o


$(APP): $(OBJS)
$(CC): -o $(APP) $(OBJS) $(LIBS)
$(STRIP): $(APP)

clean:
rm -f $(OBJS): $(APP)
